#@layout()
#define script()
<script>

    function doDelGoods(id) {
        ajaxGet("#(CPATH)/admin/article/doGoodsDel?id=" + id)
    }

    $("#batchDel").click(function () {
        var ids = getSelectedIds();
        if (ids == "") {
            alert('您未选择任何内容');
            return
        }
        ajaxGet("#(CPATH)/admin/article/doGoodsDelByIds?ids=" + ids)
    })


</script>
#end

#define css()
<style>
    strong p {
        display: inline;
    }
    td{
        text-align: center;
    }
</style>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            #if(articleTitle)
                《#(articleTitle)》的商品
            #else
                商品管理
            #end
            <small>
                Goods Management
            </small>

        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header with-border">

                        <form class="form-horizontal actionPanel" action="#(CPATH)/admin/article/goodsManage" method="get">
                            <input type="hidden" name="articleId" value="#para('articleId')">
                            <div class="row">
                                <div class="form-group col-lg-4">
                                    <label class="col-sm-3 control-label">关键字</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" name="keyword" value="#para('keyword')">
                                    </div>
                                </div>
                                <div class="form-group col-lg-8">
                                    <div class="col-sm-12">
                                        <button type="submit" class="btn btn-primary ">搜索</button>

                                    </div>
                                </div>
                            </div>
                            <!-- /.box-body -->
                        </form>

                        <div class="row actionPanel">
                            <div class="col-xs-12">
                                <button type="button" id="batchDel" class="btn btn-default checkAction"> 批量删除</button>
                            </div>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body ">

                        <table class="table table-striped">
                            <tbody>
                            <tr>
                                <th style="width: 10px">
                                    <input name="dataItem" onchange="checkAll(this)" type="checkbox" />
                                </th>
                                <th style="width: 100px;text-align: center">商品标题</th>
                                <th style="width: 150px;text-align: center">商品缩略图</th>
                                <th style="width: 260px;text-align: center">商品链接</th>
                                <th style="width: 150px;text-align: center">商品价格</th>
                                <th style="width: 150px;text-align: center">创建人</th>
                                <th style="width: 150px;text-align: center">发布时间</th>
                            </tr>

                            #for(goods : page.list)
                            <tr class="jp-actiontr">
                                <td style="vertical-align:middle;">
                                    <input class="dataItem" type="checkbox" value="#(goods.id)" onchange="dataItemChange(this)"/>
                                </td>
                                <td style="vertical-align:middle;">
                                    #(goods.title)
                                    <div class="jp-actionblock">
                                        <div class="jp-actionitem">
                                            <a href="javascript:;" onclick="doDelGoods('#(goods.id)')" class="red-action">彻底删除</a>
                                        </div>
                                    </div>
                                </td>
                                <td style="vertical-align:middle;">
                                    <img style="width: 120px;height: 120px" src="#(goods.img)">
                                </td>
                                <td style="vertical-align:middle;">
                                    <a href="#(goods.url ??)" target="_blank">#(goods.url ??)</a>
                                </td>
                                <td style="vertical-align:middle;">
                                    #(goods.price ??)
                                </td>
                                <td style="vertical-align:middle;">
                                    <a href="#(goods.user.detailUrl ??)">
                                        #(goods.user.nickname ??)
                                    </a>
                                </td>
                                <td style="vertical-align:middle;">#date(goods.created)</td>
                            </tr>
                            #end

                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-sm-12">
                                #@_paginate()
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box -->
            </div>
        </div>

    </section>


</div>
#end
